package com.cdcas.class1920;

import com.cdcas.class1920.utils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

public class ObjectInstanceFactory1 {
    private ObjectInstanceFactory1() {
    }
    public static <T> T create(Class<?> clazz,String value) {
        Object obj = null;
        try {
            obj = clazz.getDeclaredConstructor().newInstance();
            BeanUtils.setObjectValue(obj,value);
            return (T)obj;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }


    }
}
